package cloud.keveri.gateway.plugin.base;

import cloud.keveri.base.ErrorCode;
import cn.hutool.json.JSONUtil;
import org.springframework.web.server.ServerWebExchange;

import static cloud.keveri.gateway.plugin.api.GatewayPluginErrorCodeConstants.UNIQUE_ID_MUST_NOT_NULL;
import static cloud.keveri.gateway.plugin.base.def.Const.ERROR_FLAG;

/**
 * <p>
 * 作者：沈自在
 **/
public class ErrorHandler {

    public static void handlerError(ServerWebExchange exchange, ErrorCode error) {
        exchange.getAttributes().put(ERROR_FLAG, JSONUtil.toJsonStr(error));
    }
}
